<?php
include_once("Elegible.class.php");
include_once('Option.class.php');

class Select extends Elegible
{
	var $input = array(
					'select' => "<select name=\"{name}\" size=\"{size}\" id=\"{id}\"{params}>{options}</select>\n",
					'option' => "<option value=\"{value}\"{selected}>{text}</option>"
				);

	function Select($id, $options = array())
	{
		parent::Elegible($id, $options);
	}
	function __getHTML()
	{
		$options = "";
		$search  = array('{value}', '{selected}', '{text}');
		if (count($this->options) > 0)
		{
			foreach($this->options as $i => $option)
			{
				$replace = array($option->ID, ($option->tilded ? ' selected' : ''), $option->value);
				$options .= str_replace($search, $replace, $this->input['option']);
			}
		}
		$search  = array('{name}', '{size}', '{id}', '{params}', '{options}');
		$replace = array($this->getName(), $this->size, $this->ID, $this->getParams(), $options);

		return str_replace($search, $replace, $this->input['select']);
	}
}

?>